<?php $view->extend('template', 'content', array('title' => 'News'))?>


<?php $i = 0; $a = 0; $breaknext = false;?>
<?php foreach ($news as $item): ?>
	<?php 
	$i++;
	

	/**
	 *  Much php logic here, but it's all about showing 
	 *  news in a gridded pattern
	 *  Most recent news gets better space then other.
	 */
	
	
	if ($breaknext){
		echo '</div><div class="row">';
		$breaknext = false;
		$a = 0;
	}


	switch($i){
		case 1:
			$h = 'h2';
			$c = 'c12';
				
			$breaknext = true;
			
			break;

		case 2:
		case 3:
			$a++;
			$h = 'h3';
			switch($a){
				case 1: $c = 'c6'; break;
				case 2: $c = 'c6'; break;
					
			}
			if ($a == 2){
				$breaknext = true;
			}
			break;
		default:
			$a++;
			$h = 'h3';		
			switch($a){
				case 1: $c = 'c4'; break;
				case 2: $c = 'c4'; break;
				case 3: $c = 'c4'; break;
			
			}
			if ($a == 3){
				$breaknext = true;
			}
	}

	?>



	<div class="col <?php echo $c ?> news">
		<<?php echo $h?>>
			<a href="<?php echo $view->url->linkTo('News','view', array('id' => $item->getID(), 'title' => $item->getUrl()))?>"><?php echo $item->getTitle()?></a>
		</<?php echo $h?>>
		<div class="infopanel">
			<?php echo sprintf($view->lang->get('news')->get('news_meta'), $item->getDate()->format('jS F Y, g:i A'), $item->getAccount()->getUsername())?>
		</div>
		<p><?php echo substr(strip_tags($item->getText()), 0 , 200)?></p>
	</div>


<?php endforeach;?>



